package com.esri.core.tasks.geocode;

import com.esri.core.geometry.Geometry;
import com.esri.core.geometry.GeometryEngine;
import com.esri.core.geometry.Point;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.internal.util.d;
import com.esri.core.io.EsriServiceException;
import java.util.HashMap;
import java.util.Map;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class LocatorReverseGeocodeResult extends LocatorResult {
    HashMap<String, String> addressFields = new HashMap<>();

    @Override // com.esri.core.tasks.geocode.LocatorResult
    public /* bridge */ /* synthetic */ Point getLocation() {
        return super.getLocation();
    }

    @Override // com.esri.core.tasks.geocode.LocatorResult
    public /* bridge */ /* synthetic */ SpatialReference getSpatialreference() {
        return super.getSpatialreference();
    }

    @Override // com.esri.core.tasks.geocode.LocatorResult
    public /* bridge */ /* synthetic */ void setSpatialreference(SpatialReference spatialReference) {
        super.setSpatialreference(spatialReference);
    }

    public Map<String, String> getAddressFields() {
        return this.addressFields;
    }

    public static LocatorReverseGeocodeResult fromJson(JsonParser jsonParser) throws Exception {
        LocatorReverseGeocodeResult locatorReverseGeocodeResult = new LocatorReverseGeocodeResult();
        if (!jsonParser.isClosed()) {
            if (!d.c(jsonParser)) {
                throw new EsriServiceException("This response cannot be parsed.");
            }
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String currentName = jsonParser.getCurrentName();
                jsonParser.nextToken();
                if ("address".equals(currentName)) {
                    while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                        String currentName2 = jsonParser.getCurrentName();
                        jsonParser.nextToken();
                        locatorReverseGeocodeResult.addressFields.put(currentName2, jsonParser.getText());
                    }
                } else if ("location".equals(currentName)) {
                    locatorReverseGeocodeResult.location = (Point) GeometryEngine.jsonToGeometry(jsonParser).getGeometry();
                } else {
                    jsonParser.skipChildren();
                }
            }
        }
        return locatorReverseGeocodeResult;
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("LocatorReverseGeocodeResult [addressFields=");
        sb.append(this.addressFields);
        sb.append(", location=[");
        if (this.location != null) {
            sb.append(this.location.getX() + ", " + this.location.getY());
        }
        sb.append("]]");
        return sb.toString();
    }

    @Override // com.esri.core.tasks.geocode.LocatorResult
    public int hashCode() {
        int hashCode = super.hashCode() * 31;
        HashMap<String, String> hashMap = this.addressFields;
        return hashCode + (hashMap == null ? 0 : hashMap.hashCode());
    }

    @Override // com.esri.core.tasks.geocode.LocatorResult
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (super.equals(obj) && getClass() == obj.getClass()) {
            LocatorReverseGeocodeResult locatorReverseGeocodeResult = (LocatorReverseGeocodeResult) obj;
            HashMap<String, String> hashMap = this.addressFields;
            if (hashMap == null) {
                if (locatorReverseGeocodeResult.addressFields != null) {
                    return false;
                }
            } else if (!hashMap.equals(locatorReverseGeocodeResult.addressFields)) {
                return false;
            }
            return true;
        }
        return false;
    }

    void setSpatialReference(String str) {
        this.spatialreference = SpatialReference.create(str);
    }

    void setPoint(byte[] bArr) {
        this.location = (Point) GeometryEngine.geometryFromEsriShape(bArr, Geometry.Type.UNKNOWN);
    }

    void setAddressFields(String[] strArr) {
        for (int i = 0; i < strArr.length - 1; i += 2) {
            this.addressFields.put(strArr[i], strArr[i + 1]);
        }
    }
}
